import extend from 'dva-model-extend';
import settings from '@/settings';
import model from '@/baseModel';
import { getList } from '@/services/role';

const { pagination } = settings;
const initState = {

}

export default extend(model, {
  namespace: '$role',
  state: {
    ...initState
  },
  effects: {
    *fetchList({ payload = pagination }, { call, put }) {
      const { data } = yield call(getList, payload);
      yield put({
        type: 'updateState',
        payload: {
          list: data,
          params: payload,
        },
      });
    },
  },
});
